﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Services_getImagetype : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "text/xml";
        Response.Charset = "utf-8";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");

        string IamgeName = Request.QueryString[0].ToString().Trim();
        string result = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "\n";
        result += "<Images>" + "\n";

        try
        {
            string queryString = "select type from district_image_sp_map where imageid = '" + IamgeName + "'";
            DataSet ds = AccessDatabase.Query(queryString);
            DataTable dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    result += "<Image type = '" + dt.Rows[i][0].ToString().Trim() + "'/>" + "\n";
                }
            }
            else
            {
                result += "<Image type = 'Error'/>" + "\n";
            }
        }
        catch (Exception ex)
        {
            Log.WriteException(ex.Message.ToString());
            result += "<Image id = 'Error'/>" + "\n";
        }
        result += "</Images>" + "\n";
        Response.Write(result);
    }
}
